<style>
<!--
body.ajax-index-options{
 width:380px;
 padding:0px;
 margin:0px;
}
body.ajax-index-options .product-shop .product-options-bottom .price-box{
 float:left;
}
-->
</style>
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<script type="text/javascript">
    var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
</script>
<div class="product-view" style="width:380px">
    <div class="product-essential" style="width:330px">
    <form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
        <div class="no-display">
            <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
            <input type="hidden" name="related_product" id="related-products-field" value="" />
        </div>

	
        <div class="product-shop">
            <div class="product-name">
                <h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
            </div>
    
    		<?php echo $this->getChildHtml('product_type_data') ?>
    		
    		<?php if (!$this->hasOptions()):?>
                <div class="add-to-box">
                    <?php if($_product->isSaleable()): ?>
                        <?php echo $this->getChildHtml('addtocart') ?>
                    <?php endif; ?>
                </div>
            <?php endif; ?>
    		        
            <?php if ($_product->isSaleable() && $this->hasOptions()):?>
                <?php echo $this->getChildChildHtml('container1', '', true, true) ?>
            <?php endif;?>

        </div>
        <div class="clearer"></div>
        <?php if ($_product->isSaleable() && $this->hasOptions()):?>
            <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
        <?php endif;?>
    </form>
    <script type="text/javascript">
    //<![CDATA[
        var productAddToCartForm = new VarienForm('product_addtocart_form');
    	productAddToCartForm.submit = function(button, url) {
		if (this.validator.validate()) {
			var form = this.form;
			var oldUrl = form.action;
			if (url) {
				form.action = url;
			}
			var e = null;
			// Start of our new ajax code
			if (!url) {
				url = jQuery('#product_addtocart_form').attr('action');
			}
			url = url.replace("checkout/cart","ajax/index"); // New Code
			var data = jQuery('#product_addtocart_form').serialize();
			data += '&isAjax=1';
			jQuery('#ajax_loader').show();
			try {
				jQuery.ajax( {
					url : url,
					dataType : 'json',
					type : 'post',
					data : data,
					success : function(data) {
						jQuery('#ajax_loader').hide();
                        parent.setAjaxData(data,true);
					}
				});
			} catch (e) {
			}
			// End of our new ajax code
			this.form.action = oldUrl;
			if (e) {
				throw e;
			}
		}
	}.bind(productAddToCartForm);
    productAddToCartForm.submitLight = function(button, url){
            if(this.validator) {
                var nv = Validation.methods;
                delete Validation.methods['required-entry'];
                delete Validation.methods['validate-one-required'];
                delete Validation.methods['validate-one-required-by-name'];
                if (this.validator.validate()) {
                    if (url) {
                        this.form.action = url;
                    }
                    this.form.submit();
                }
                Object.extend(Validation.methods, nv);
            }
        }.bind(productAddToCartForm);
    //]]>
    </script>
    </div>
</div>